home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_06_02 / v6n2010a.txt < prev    next >
Text File  |  1989-09-26  |  691b  |  26 lines

  1.  
  2.       do_something(a,b)
  3.       /* This function does something with a and b*/
  4.           {
  5.           int ret;
  6.           char arg1[10];
  7.           char arg2[10];
  8.  
  9.           /* Turn the arguments to strings */
  10.           sprintf(arg1,"%d",a);
  11.           sprintf(arg2,"%d",b);
  12.  
  13.           /* Execute the program */
  14.           if (fork() == 0)
  15.                execlp("domain","domain",arg1,arg2);
  16.  
  17.           /* Wait till it is finished and get the return code */
  18.           wait(&ret);                         
  19.  
  20.           /* Shift it over, as the return code is in 
  21.                 the high order bits */         
  22.           ret >> 8 && 0xFF;
  23.  
  24.           return ret;
  25.           }
  26.